#include<iostream>
using namespace std;
#include<vector>
class Solution {
public:
    vector<string> letterCombinations(string digits) {
        vector<string> v;
        vector<string> num;
        for (auto i : digits)
        {
            if (i == '2')
            {
                num.push_back("abc");
            }
            else if (i == '3')
            {
                num.push_back("def");
            }
            else if (i == '4')
            {
                num.push_back("ghi");
            }
            else if (i == '5')
            {
                num.push_back("jkl");
            }
            else if (i == '6')
            {
                num.push_back("mno");
            }
            else if (i == '7')
            {
                num.push_back("pqrs");
            }
            else if (i == '8')
            {
                num.push_back("tuv");
            }
            else
                num.push_back("wxyz");
        }
        int k = 0;
        string s;

        push_c(num, v, 0, s);

        return v;
    }
    void push_c(vector<string>& num, vector<string>& v, int now, string& s)
    {
        if (now == num.size())
        {
            v.push_back(s);
            return;
        }
        for (int i = 0; i < num[now].size(); i++)
        {
            s.push_back(num[now][i]);
            push_c(num, v, now + 1, s);
            s.pop_back();
        }
    }
};
int main()
{
    vector<string> v = Solution().letterCombinations("23");
    for (auto i : v)
    {
        cout << i << ' ';
    }
}